<div>
<div class="films index">
	<h2><?php echo __('Listado de peliculas');?></h2>	
	<?php if(isset($films)): ?>
	<table cellpadding="0" cellspacing="0">
	<?php
	$cant=0;
	foreach ($films as $film): ?>	
	<?php if($cant%3==0)
			if($cant==0)
				echo '<tr>';
			else
				echo '</tr><tr>';
		  $cant++;
	?>
		<td><div class="title"><?php echo h($film['Film']['title']); ?>&nbsp;</div>
			<div><?php echo $this->Html->image($film['Film']['Image'],array('alt' => 'No se encuentra la imagen', 'url' => '/films/view/'.$film["Film"]["id"], 'class' =>'imagen')); ?></div>
			<div class="sinopsis">
				<?php echo substr($film['Film']['synopsis'],0,100).'...';?>
				<span><?php echo $this->Html->Link('More',array('action'=>'view',$film['Film']['id']));?></span>
				
			<div>
		<?php if(AuthComponent::user()):?>
			<div class="actions edicion">
				<?php echo $this->Html->link(__('View'), array('action' => 'view', $film['Film']['id'])); ?>
				<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $film['Film']['id'])); ?>
				<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $film['Film']['id']), null, __('Are you sure you want to delete # %s?', $film['Film']['id'])); ?>
			</div>
			</td>	
		<?php endif?>
<?php endforeach; 
	if($cant%3==1)
		echo '<td></td><td></td>';
	else
		if($cant%3==2)
			echo '<td></td>';
?>

	</tr>
	</table>
<?php endif?>
</div>



<div class="actors index">
	<h2><?php echo __('Actors');?></h2>
	<?php if(isset($actors)): ?>
	<table cellpadding="0" cellspacing="0">
	<?php
	$cant=0;
	
	 foreach ($actors as $actor): 
		if($cant%3==0)
			if($cant==0)
				echo '<tr>';
			else
				echo '</tr><tr>';
		  $cant++;
	?>
		<td><div class="title"><?php echo h($actor['Actor']['name']); ?>&nbsp;</div>
			<div><?php echo $this->Html->image($actor['Actor']['photo'],array('alt' => 'No se encuentra la imagen', 'url' => '/actors/view/'.$actor["Actor"]["id"], 'class' =>'imagen')); ?></div>
			<div class="bio">
				<?php echo substr($actor['Actor']['biography'],0,100).'...';?>
				<span><?php echo $this->Html->Link('More',array('action'=>'view',$actor['Actor']['id']));?></span>				
			<div>
		<?php if(AuthComponent::user()):?>
			<div class="actions edicion">
				<?php echo $this->Html->link(__('View'), array('action' => 'view', $actor["Actor"]["id"])); ?>
				<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $actor["Actor"]["id"])); ?>
				<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $actor["Actor"]["id"]), null, __('Are you sure you want to delete # %s?', $actor["Actor"]["id"])); ?>
			</div>
			</td>	
		<?php endif?>
	<?php endforeach; 
	if($cant%3==1)
		echo '<td></td><td></td>';
	else
		if($cant%3==0)
			echo '<td></td>';
	?>
	</tr>
	</table>
<?php endif?>

</div>



<div class="directors index">

	<h2><?php echo __('Directors');?></h2>
	<?php if(isset($directors)): ?>
	<table cellpadding="0" cellspacing="0">
	<?php
	$cant=0;
	foreach ($directors as $director): 
		if($cant%2==0)
			if($cant==0)
				echo '<tr>';
			else
				echo '</tr><tr>';
		  $cant++;
	?>
	<td><div class="title"><?php echo h($director['Director']['name']); ?>&nbsp;</div>
		<div><?php echo $this->Html->image($director['Director']['photo'],array('alt' => 'No se encuentra la imagen', 'url' => '/directors/view/'.$director['Director']["id"], 'class' =>'imagen')); ?></div>
		<div class="bio">
				<?php echo substr($director['Director']['biography'],0,100).'...';?>
				<span><?php echo $this->Html->Link('More',array('action'=>'view',$director['Director']['id']));?></span>				
		<div>
		<?php if(AuthComponent::user()):?>
			<div class="actions edicion">
				<?php echo $this->Html->link(__('View'), array('action' => 'view', $director["Director"]["id"])); ?>
				<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $director["Director"]["id"])); ?>
				<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $director["Director"]["id"]), null, __('Are you sure you want to delete # %s?', $director["Director"]["id"])); ?>
			</div>
			</td>	
		<?php endif?>
	<?php endforeach; 
	if($cant%3==1)
		echo '<td></td><td></td>';
	else
		if($cant%3==0)
			echo '<td></td>';
	?>
	</tr>
	</table>
	<?php endif?>
</div>

</div>

